#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    int minMaxGame(vector<int> &nums)
    {
        vector<int> t;
        while (nums.size() != 1)
        {
            t.clear();
            int count = 0;
            for (int i = 0; i < nums.size(); i += 2)
            {
                int tmp = nums[i];
                if (count % 2)
                {
                    tmp = max(nums[i], nums[i + 1]);
                }
                else
                {
                    tmp = min(nums[i], nums[i + 1]);
                }
                t.push_back(tmp);
                ++count;
            }
            nums = t;
        }
        return nums[0];
    }
};